/* 
 * File:   controlador.h
 * Author: fer
 *
 * Created on 26 de agosto de 2011, 0:03
 */
/*This file is part of Sandbox.

Sandbox is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License.

Sandbox is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Sandbox.  If not, see <http://www.gnu.org/licenses/>.

For contact, see the About page of my blog: <http://mygeekyware.wordpress.com/>.*/

#ifndef CONTROLADOR_H
#define	CONTROLADOR_H

#include <SDL/SDL.h>
#include "particula.h"

class controlador {
public:
    controlador();
    controlador(const controlador& orig);
    virtual ~controlador();
    void Update(particula matriz[400][220]);

    void MenuDerecho(int , int);  //Definido en menus.cpp
    void MenuIzquierdo(int , int, int);//Definido en menus.cpp
    void Pincel(particula matriz[400][220], int, int);
    void SetPixel(particula matriz[400][220], int, int);

    void UpdateMatrix(particula matriz[400][220]);
    void Copy(particula matriz[400][220], int x, int y, int dx, int dy);
    void Swap(particula matriz[400][220], int x, int y, int dx, int dy);
    void Clear(particula matriz[400][220], int x, int y);
    bool chkReaction(int, int);
    int get_weight(int);
    void UpdateTemperature(particula matriz[400][220], int x, int y);

    int brsize; //Tamaño del pincel
    int brtype; //Tipo de pincel
    int brtype2;
    int mx,my;
    Uint8 *keys;
    int mouse1pushed;
    bool reset;
    int particlescount;
    int contadorgeneral;
    int speed;

    //Individual particles update methods
    void Water(particula matriz[400][220], int x, int y);
    void Sand(particula matriz[400][220], int x, int y);
    void Salt(particula matriz[400][220], int x, int y);
    void Fire(particula matriz[400][220], int x, int y);
    void SaltWater(particula matriz[400][220], int x, int y);
    void Stone(particula matriz[400][220], int x, int y);
    void Earth(particula matriz[400][220], int x, int y);
    void Plant(particula matriz[400][220], int x, int y);
    void Steam(particula matriz[400][220], int x, int y);
    void Ice(particula matriz[400][220], int x, int y);
    void Magma(particula matriz[400][220], int x, int y);
    void Firework(particula matriz[400][220], int x, int y);
    void Torch(particula matriz[400][220], int x, int y);
    void Bomb(particula matriz[400][220], int x, int y);
    void Fuse(particula matriz[400][220], int x, int y);
    void Oil(particula matriz[400][220], int x, int y);

    //Reaction functions
    void Salt2Water(particula matriz[400][220], int x, int y, int x2, int y2);
    void MakePlant(particula matriz[400][220], int x, int y);
    void Plant2Fire(particula matriz[400][220], int x, int y);
    void Water2Steam(particula matriz[400][220], int x, int y);
    void Steam2Water(particula matriz[400][220], int x, int y);
    void Saltwater2Steam(particula matriz[400][220], int x, int y);
    void Water2Ice(particula matriz[400][220], int x, int y);
    void WaterMagma2Stone(particula matriz[400][220], int x, int y, int x2, int y2);
    void ExplodeBomb(particula matriz[400][220], int x, int y);
private:

};

#endif	/* CONTROLADOR_H */

